basic template for smith-waterman searching