Minor tide ups to the code