Changed key capture events to avoid possible conflicts