main now supports logging