loops added to grammar