Fixing cycles, cleaning up warnings