a few more tweaks to the code