more refactoring, prepring code to painting map terrain