added unit tests and end to end tests