added exception to throw
added comments and streamlined some functions
changed calculations for heading
removed testfile