Frontend event model: better error handling, beautify a bit (#832 related)