Getting rid of anonymous functions