Remove duplicate code for alternative function