added grms function