Fixes round

Few fixes and improvements.
Superseds previous pull requests.