Create method for duplicate code