Improve parser and introduce unittests