Refactoring calc_points