Cleanup, removing globals and unused methods

Change-Id: Iff5273b8f8e4c20290dfe52d517173178d666e9e