cleaning up function length finding code