temporary(crappy) fix for trig bugs, cleaned up some stuff