changed code so that seed is now input parameter