Improved program logic