Cleaned up the codes. Refs #9243.