Refactoring for better bash style.