Refactor & Add HintFile support.

Signed-off-by: Shindo Wu <cn.shindo@gmail.com>
Bug fixes.