refined the logic in source code.