Refactored code and add in optional module grades