Added distributions.  Refactored the code.