[FIX] Issue with refactooring functions