Refactor code to use method references