Added more optimizations to Needleman-Wunsch alignment