Moved build out in to a function