Code cleanup

4 commits that cleanup code by using more shell built-ins.
Comment fixed in 2ee4b6f414543259082f0473baaa4f113a330527