moved the random challenge function to the end