Code cleanup, moved arg parsing to own module.