Updates based on comments by @alexeyten.