Updated arg parser. Now uses for-each loop instead of static switch-case statement.