Use __git_ps1 only if exists
Put code into functions. Fix var names