Removade some repeated code