Adding tests and cleaning up basic assumptions about errors and where to start