cleaned up daemon example and refactored to run without the daemon flag