updated from lyra (working on CAVE2)