Improve from morris821028 version