replacing depcreated method