adapt api for daemon to match example in issue #50 and fix syntax errors