Unified both methods in one

Now both methods use a new static method to avoid duplicated code