better to create a separate function to do this functionality