Refactor configure