split off the main code into a seporate file...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>