added additional random func, fixed two minor issues