Improvements and bugfix