refactor debug prints