change double totalMates to Integer