Improved test case and added code comments