Write logic, but refactor needed.