Added some documentation, cleaned up (at least a bit), and removed old unneeded code