MDL-22164 backup - clean important parts of old code. Leaving rest for reference