Completed remaining functionality and added unit test cases
Corrected output format