Refactor and tidy string based parsing
Stream based solution for parsing