forward declaration and endless loop detection