refactor filestructure and add tests