Moved everything to a convenience function.