Added unit tests and implemented initial functionality.