removing use of exceptions, to allow for better json formatting of errors
fixed tests and made for better errors