moved exceptions to top level