secod refactor.