added key press&release logic