Little cleaning up of the random function