added math.h link, wrote bulk of code, needs debuggin