refactored to be instance-based