rewrote parts of TDL parser to make extensions possible (cleanup)