initialize $phonegap.ready, cleanup, reorder script statements