destructors must always free objects
added some complex math functions
fixed a buffer overrun error related to format strings