Prefer return-early style to nested code.
Bring a critical method to the top of the list.
A slightly stricter regex for finding the git version.
Add missing require.