Completely moved tilemap functions to separate class.