small improvements in code