Added makeHandler, a wrapper to abstract some common functionality, to remove repeated code.