Refactor to use with PhoneGap CLI