Little refactorings and replace deprecated code.