Added unit tests and docs