Added documentation and optimized util

I think this is done for some testing and later forgot to remove it.