added a load of comments and reordered functions
I tried to reorder the functions in a more logical way, in rough complexity
order, ie point, line, circle, rect, polygon. Also moved 'helper'
functions to the bottom.
most of the comments are still placeholders, auto generated and added
description, but need args and return documenting