Implemented sampling of the prior