Generic approach

generic approach is done
should be merged to master branch