Refactored to change command H to do command V on transposed image :)