Extract parsing methods to Parser class