added log hook and mutability cleanup #25