added tests
added tests
rewrote parseEnd