Reorganizing code, putitng Random on its own from template callable functions