Fixed all bugs, cyclic case next