more proper clean-up on exit
correct key indexes
output only on event and other small changes