Perform copylen computation only if needed
Remove duplicate lines in example code