refactor business logic