A few code semantic changes as per Mars' advice