Added seed input, shortened code