improving key callback