Added some probably needed utility functions