moved debugging functions