Removed format option, now supports JSON only

Fixed missing return statements
Tidy up