Refactored preview some more and added undo controller spec tests