Ks

Your comment: implementation is not perfect, please think about
improvement of generalisation of subactions usage
I tried to improve it, please see what has been done