slight refactor based on code review.