Add logging and remove deprecated code