Crappy version of internal border detection

Signed-off-by: Luiz Carlos Cavalcanti <cavalcanti.luiz@gmail.com>