added consensus and gap filter subroutines