Beginning of argument parsing, some small refactorization