Added functions for unit cost calculation