Got code working with latest refactoring (changed to struct rather than tuple)