updating jquery mobile and lots of refactoring