Refactor based on comments.