I used an obsolete branch for doing this PR, so maybe this function causes some issues in the merging process, sorry for possible inconvenience.