Simplify.
Integrate tests.
Factorise code to get or pop random items from a list.
Simplify.