Several changes:
- Moved all the stuff related to logging to file;
- Moved all stuff related to setup of environment to a file
- Start of pid control