many fixes and additions