refactored and added count for all orders