Cleaned up item_factory implementation