refactored for use of external generator and operations