More debug code removal
First steps at implementing events.