Refactored opts parsing.