added pai's changes