Best elegant way to do the keyboard management