Changes suggested by @javiereguiluz.