Structure changed to make compatible with phonegap