Refactored BUGS.cpp to take distributions from a map