Added some convenience functions

Just added a few functions that we found useful where I work, so I assume others might, too. The rest is mostly debugging output.