Fixed critical loop failure.
Made test and fixed errors in class.