adding calculate module, including all changes to relative files that come with it
lots of changes here: expect bugs, MUST be unit tested