abstracted code to improve read ability