Remove BASH-isms and reorganize source