Code cleanup

4 commits that cleanup code by using more shell built-ins.