added state class
updated model to use states
can now retain/release null meshes safely
fixed some reference stuff
fixed reference stuff and added collision methods
added more math functions
started work on collision algorithm