Improve code according to the comments.