PTR support, logging refactor