Refactor Game engine