[TASK] Refactor method to simplify code