Add a build status API endpoint and a little refactoring in this area