Updated doc and improved range checking of values.