change build_index() to build()