Changed H search and V search to incorporate exception and change into two loops