Made 2db scripts more modular and improved cash position handling.