refactored and tested Gmg parser