Added newer headers to main.h, started to rewrite main implmentation, added math dep to makefile.