Completely refactored libmbd into parsing routines

and data accessor functionality.