pull out key toggle logic