General improvements following code review