Small fix and code cleanup