Code clean-up and minor edits