New method of determining current branch (now works within subdirectories)