adds checkmark toggle functionality
Replaces my code with RWunderlich code from the end of chapter 2.