Added cost calculation and integrated into a centralized main class