When defining ahandler function, create the function first and then add it to the handler list, instead of the other way around