code cleanup and overhaul of HOscillator