collection demo: improve key handler