Using Dynamo to Adjust Wall Top Extension Distance to adjacent Ceiling height

Hey @GregX sorry to bother you, could you help me with this spots of the script where i can’t see clear.

Also i tried to guess and am having an error over here: