more playing with randomness
refactoring