Replace assign with capture