Lottery front end module: refactor code to use helper function.