refactor code and added test cases for groupInfo, improved error handler