changing the bind event function and including a init function