add comments and edit naming for clarity