Refatored callback