Some fixes to the syntax mode
A bit of cleanup. Removed some unused code.