Write functions in a more functional way.