sort working. slight tweaks