Add doc and fix some var name
Add some tests