Updated with cost analysis