How to find border markings

As you have not provided a minimal example illustrating your issue, it is a rather tedious thing to debug your code. As you have not supplied any reproducible meshes, or changed your example to illustrate how one should actually restrict the boundary conditions, there is limits to what I am willing to do by visual inspection of your code.

You should use the minimal example I showed above as a template to illustrate the issues you are currently having. For more guidelines see Read before posting: How do I get my question answered?