Implemented jquery mobile storage api

and cleaned up the rest of the code