we may want to abstract this out to another file and make this a helper function?