Added some convenience functions to main.