Reorganized code into a point store object and a mesh manipulating object.

Also some code cleanup (there were a few ugly things IMO.)