Added logic to game controller and fixed bugs