fix procedure and other parsing errors. Day of refactoring.