Added comments and streamlining