Refactor behaviors to use partially applied functions

This shouldn't change the way behaviors worked, but it should remove some of its hackish roots.