removing deprecation warnings
better factory