Added support for End statement.
Re-applied commenting out of Catch count check which seemed to have disappeared in the recent repo issues.
Improved support for importing files.
fix searching for "if" if "endif" already closed an if-statement