No longer hard-coded to master

Still hard-coded to origin
Other misc fixes (usage exits, reduced duplication, better function
calling)