Massive refactor to make textures work