restructured modules and added tests