Many fixes and changes