A bit of refactoring to seperate the UI and Spreadsheet