Removed unnecessary repetition and unnecessary anonymous function