Code and resource use tweaks

Slight code and resource usage tweaks.