Rework the build function, change arguments orders