minor change and optimization.