applied Ph's seltags-simplification with some modifications