Added attribution and took out some unnecessary code