Devided run() from main().

Signed-off-by: Kouhei Maeda <mkouhei@palmtb.net>