improvements in the code