now properly matches first and last extensions