moved logic in test