program logic simplified