New version based on feedback from code review