Removing unnecessary code and adding comments