added performance improvement suggestion by @eordano