I will admit that I don't remember why I initially wrote this function.  

The [WIP] tag is very appropriate. :)