Added support for more than 2 grades