cleaned up pairedregion code and other minor tidying up