Generalized build_id method