Add ~/.local/bin to path if it exists
Make style more consistent

Prefer "function ... {...}" to "...() {...}" because it's more readable,
especially for people who are unfamiliar with shell script. Prefer
"then" on its own line for two reasons: 1) It's more readable, since
long conditionals will be separated from the body by a "then" on its own
line, and with short conditionals there is a larger block of text that
begins the body; and 2) it encourages more portable shell scripting
habits.