Controller refactoring and data conversion to CSV.