Refactor code

(is this a lambda expression?)