Syntax fixes, procedures added, more error checking.