Updated code to match PhoneGap Camera tutorial