Merge changes I9ea3677d,I0a59dce8

* changes:
  Migrate away from using ServiceManager
  Migrate StatsManager to apex