Separate header

* wrap demo in `try/catch`
* add debug symbols flag to cmake lists 
* Add warning flags and turn warnings into errors
* refactor interaction with curl to use callback to reduce code duplication.