refined code

refined code