created some overideable wrapper functions to make unit testing easier.