Work on progress #1
Add main loop, logging and other small things