tidy stuff up, add handleEvent method