improved program structure