Fixed bugs and tested all use-case.