mas refactor y tests