Better support for external csv data, basic support for extending options, some functions moved to helper functions