modified to fit pattern