Tweaks to how the code works