reorganized things and added key events