Push some code into cpp files instead of headers.

Refactor into classes.

Create separate thread for http server