Some optimizations & polishing following PR #3381