Added changes to code and comments