Change type of len parameter to validation function.