Removed duplicate code and improved usage documentation.