Use function literals and closures, reorder funcs.