Code cleaning
Misc fixes