Added unittests for comment removal and improved comment removal for border cases

Add some basic unittests for comment removal and improved the code to handle some border cases correctly