More refactoring

Move almost everything out of the main file (except AI)
turn AI into an EntityComponent