refactor options parser