Cleaned up the script a bit, removed logging.