Added bound and adjacent check