Refactor big main services into several pieces