Move optimization, pricing, and utiliti functions to separate scripts