some improvements in the code clarity