In-progress refactor to have service-based code structure.