Reorganisation of event code + a test