Improvements and a bug fix