remove parens around body of anonymous function
add proper return type to extracted closure
handle each inbound dependency only once