Refactoring notes

Clean up the code so it's kind of reasonable and split reused functionality.

This should also let us use directories.
[bash.d] Updating repo functions and notes functions