Added initial keyboard appearance handling code