Added a nil response for bad requests
Added a to_json method that returns the data without a wrapper