Added dams and added cycle detection + handling!