Reworked structure and added in logic for tiles.