Debug functions cleanup