refactor according to the review