Refactoring debugging utilities into module