Automatic Teaching feature by CTD

New pull request with his changes and my own changes after code review.