Improved test cases and not needed code removed