More functionality and refactoring.
Finished the test implementation.