Minor code changes and comments