Rearranged code to allow main activity to relaunch service if it is not running, cleaned up some minor stuff.
Fixed missing calls to super.onCreate and super.onDestroy.
Added a redundant device shutdown just in case the service is forced to shut down.