relink textures, minor code cleanup