third refactor