small improvements in the code