Small changes to tighten up code