These lines of code are duplicated. Could you place them into a function() and then call the function instead?