new file scanbalance.cpp