Moved some steps in build() into prepare()