Move all procedures into bash_dispatch

The blocks sourcing the local versions of files are now in
the main bash_dispatch script.

Also added debug facilities
Moved sourcing blocks into a function

Also cleaned up all function definitions and environment variables