BF + TST: Robustification and testing of utility function.

This function was previously untested and malfunctioned under certain conditions. Now it's being tested and is a bit more robust