Added jQM support and refactoring code