Improvements and more test added