Cleanup gitrepo, builds based on branch or id
Take root JSON object for response
Move most functionality out of main script