Code exercises from Chris Pine's book