adding many fixes and changes