factored a bunch of things into single functions by adding parameters