Remove more duplicated code