Cleaned code. Added comments. OnResume OnPause works.