refactoring, added deprecation checks