Adding IV.  Refactored some code.