created function to setup handlers