Various cleanup mostly related to formatting.
Added test cases.
Added test cases.
Added tests.
Merge pull request #223 from drusk/testing_and_cleanup

Testing and cleanup