Several improvements
Fixed const-correctness