cleaned up shared texture functions a bit