Fixed line endings, adding some printing.
Fixed abstract algorithm