Refactor general del codigo