Removing some redundant lines in the code