abstracted more code