ported to the rescala refactoring
minor changes