Added ts preview, sorting functions, dragging. Code must be cleaned