applying changes suggested by Alex