mess of my modifications and updates from dev branch