added unit tests and updated