tiny improvements in the implementation