Fixed some memleaks, added math library.

Reduced mem leak down to 2. Needs fix after component system is
complete.

Math library is still experimental.