More refractoring, also fixed an issue concerning tilemaps not handling mirroring correctly due to a wrong assignment.