reorganized some libraries, added some tests