fixes key actions handler and general cleanup