Sidebar and image preview refactored