Added final
Adapted to newest libs
Use mutable instead of ugly const_cast