make a couple of smaller functions