added more unit tests
made corrections to bugs found while testing
added unit tests