program logic fixed