Minor tweaks

Small modifications and cleanup of code.