#40

Sorry for the huge pull request, but implementing CTI affects a lot of pieces in the project.