Many fixes and cleaning