Implement proper logging + --debug flag