Implemented some log functionality and fixed a bug in game code