preview functionality simplified and clearer (+some more small changes)