sort and separate imports