made some changes by Quan