code now compiles (with warnings for unused variables)