More code improvement
Add more tests