Refactoring

Trying to clean the codes through

1. Reconstruct API structure through extracting functions
2. Remove unclear `Cursor` class
3. Make exception handling briefer
4. Make constructing  json data procedure briefer

Some of them are started now, but none of them is done completely yet.
It will be my pleasure reviewing my code, or saying something more which are needed to be refactored.