Reorganized files, added tests