Move view logic out of event handling

See #105