Refactored the main arguments parsing into a static method.