Defined a function for calculating time averaged value, added key_func()
add mouse_func()
Simplified function arguments
added display_function