Implementing the context-tree weighting method