Move key Handler to dedicated function