Move edit logic to an individual function

It is better to separate this logic from
the parameter logic in main().
1 file changed