Cocision, optimization, and add exception hadling.