Upgraded to NewGazService, fixed bugs and added unittest.