Improvement and bug fixes