Cleaning 1

Some preliminary steps to organize the code. Comments and such still
need to be added. Yeah…