refactored.  V2