Refactor to class for an animate object