common module, moved cli args handling code here