Refactored the code to remove irrelevant lines

Refactored the code to remove unnecessary/irrelevant lines.