add changes suggested by @chrissorchard