Moved debug output to utils
Use dbgError in tests