More code improvement based on code review