Commitment, Flexibility, and Optimal Screening of Time Inconsistency