decouple and refactor