Fixed bugs.
Refactored target mode.