Refactored game code (mostly renamed stuff so it is more clear).