started writting bubble-detection by comparison with a generated matrix