updated version for stan-reference