Changed variable names to match those described in comments

Changed variable names to match those described in comments. `$num` -> `$length`