Simplifying logic and adding logger that goes to stdout and the log
file.