solid server code that handles 4 events