Simplify check for disconnected compounds

I simplified a bit conditions checking whether we are dealing with a
disconnected compound. Also, removed bunch of unused lines.
Make a little code cleanup

I made a few minor changes hopefully improving code clarity.
Fix small error in stats printing

The elements of join() function were integer not strings as it expects.
I added missing conversion to strings.