Moving code around so handlers and their tests can be in separate files