Added preview window, plus some code refactor