Changes for refactor

It still works exactly as before. I need to do some more changes before I can implement maps.