Correct issue 318 + refactor argument parser