tidied random example
refactor tests