Cleaned up code, fixed round restart bug