Changed the main routines to accomodate the new sam converter.
Better PEP8 conformance.