Fixed border detection

Updated overlap and SCM codes