add tests and rearrange some files