main: clean up code

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Remove unnecessary code

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Move code into appropriate function

Signed-off-by: SeongJae Park <sj38.park@gmail.com>