1. add some comments; 2. add SetHandlers function