refactored to remove warning