Functionize some of the processes.

Functionize some of the process in the input.php.
We should functionize all the dirth process in the same way.