modified build_records method