Made classification stepwise / fixed possible bug