Some initial changes to make learning code more efficient.