More duplicated code refactor