Yeah, it can be refactored applying the DRY principle. Thanks :)