Make it work with sorting etc.