Refactor find-component-main to use an iterative loop/recur pattern instead of direct recursion and added cycle detection for malformed data structures. Signed-off-by: Andrey Antukh <niwi@niwi.nz>