These four lines could be simplified by using nextgroup