updating to use plen variable