restructured library and tests