Some code cleaning. Minor bugs solved.