Refactor del codigo