Refactor method based on review comments