Target action recognition and refactoring.
Some refactoring.
merge