separated out event handling from fsmonitor
Event handling is in main while I work on a more complex event handling function.