refs #7144 Refactored code and made a few additions and deletions.