call event bindings after function definitions

now its all working