refactor console.log -> debug