Restructured code to work with multiple objects in a file and prepare for textures.
Doesn't work right now.