Removed extra code path for 1D and added test for zero length input.