Command line script

- move __main__ to script
- fix logging