Cleanup and error handling.
Merge branch 'feature/semaphore-plugin'