Add documentation

Convert the documentation that Max originally referenced here, in his answer to a stackoverflow question about documentation: http://stackoverflow.com/a/23278487