Additional syntax and logic fixed