Some corrections and comments. Better performance in some functions...