Fixed a bug.
Reorganized some code and implemented target URL parsing.