Issues resolved

Checking mechanism implemented which will make sure the output is
topologically consistent.