Minor corrections and code cleaning