Divided in modules, added tests