Added comments, cleaned up code for pre-release
Added more tests