reorganize code and remove all warnings
more simplification, still some questions, but works fine. started index page split, had to move stuff to code2...