Simplifed some redundant code.