Updated with documentation and formatting.