Replace derecated method pipe with then