complete build function