improved get_maxsuspensiongradedlayer function