made some minor modification