Initial set of changes

Migrated changes from the first phase of development.
Second set of changes

Migrating more recent changes (some extra command line parameters,
finished head repositioning feature, etc.)
Minor changes

Made small corrections and removed several already commented-out parts.
Merge branch 'migrate-cvc-changes'