changes

renamed some variables and formatted the logic method for better
understanding