updated code to support multiple instances, fix "max" view, dragging