Moved logic to service