Increase maximum matrix length from 5 to 17 when mode is 'h' or 'v'