Lightly refactor main source file.

At some point it would be nice to remove those huge arrays and put them in another data structure, preferably in their own file or files.

Signed-off-by: Archer70 <code.archer70@gmail.com>