Server now handles infinite loops by setting a timelimit on execution

Cleaned up code a bit All tests pass