updated comments, variables and streamlining of code