added horizontal sorting