Improvements and bug fixed