First working version with Gap identification and counting