implements initialization process.
add mouse events.