Can you just double check if the complexity if this function is higher then the limit i think 10, maybe it can be simplified a bit