Code conventions, and some improvements