Passing tests, need to refactor.
Factored out useless class.
Minor cleanup.
Adding tests for some border cases.