moved command line parser function