classes switchable and added the algorithm with some sytax highlighting