Add documentation and fix nitpicks