implementation of the cave object