Parser module, tests, some type declarations and refactoring