could we at least define this outside the scope of this other function? i don't like really long functions. then we can bind the scope when we set it to be the handler