modified 1030.cpp