better error handling on types
use ActionController::Responder to output json instead of Controller