Implemented random generation, and a number of other changes...