fix another newline bug, change exceptions, add documentation