Refactor a little
Register and call handler functions