Finally compiles
Tracking down undefined