some tweaks suggested by @sstucki