cleaned up with pyflakes
pasted in random gen (incomplete)