mostly done except sorting