Changed to include a handler function wrapper