Code for main tank operation taking shape