functionality more or less matches original JS version