Calculate number of columns based on the width of the window.
Refactor ThoughtsController.