debug mixin, code cleanup