refactored code, implemeneted get_summary