can we please extract the keydump code in a function like the other ones?