many upgrades and bug fixes