Small improvements of code