bashrc - improving some organization

- encapsulating some parts into functions so that they can have `local`
  variables and i don't have to manually cleanup at the end
- making sure all my bashrc functions are namespaced