Added shell functions with a lot of tests/debug output
Dropped a lot of debug output/test comments