code update based on comment