Parser rewrite

Added document parse functionality