WIP: fix bad style and add names to anonymous functions