Bug fixes and starting to implement csv interface.