Write unit test cases for better testing and maintainability.
Made a PR for it - https://github.com/coderwassananmol/BUB2/pull/188