Added 2 changes suggested by @robin850