debounce function
add key press handling