Fix textures not appearing issue, cleanup code