Refactored into class form.