made some corrections and added unit tests