small final tweaks to the code