cleaned up early tests and added error handler