Finished adding unit tests and refining functionality.