Break out functions to create handlers instead of inlining.