Improve preample processing so it can access $dataset