refactoring 0x01

Subdivide the process in order to shorten the main processing loop,
divided into a plurality of modules and functions.