refactor parser code, add some more cases
fix encoding issues