reorganize directory structure and add tests