Improved to be more versatile.