implement logging, clean up and fix printing related to command parsing