added logger and debugging option