updated with brt function and code