Major refactor! Made ready for multiplayer