Many fixes and additions