added threshold to border