ported to rescala after the restructuring