Logic refactoring.

Argument parsing logic is now shorter and clearer.
Merge pull request #9 from daniel-star/logic-refactoring

Logic refactoring.