Refactored argument parsing, simplified main