re-factored to allow for branch builds