cleanup and reaarange