added time limit & cleaned up error reporting