removed max classes
fast algorithm is done