WIP on sorting directive, but index switching works now