more refinements
add randomness helper functions, etc.