Improved updating of sort orders to use raw queries resolves issue 4