handled border conditions