optimize by remembering len()
make drag command depend on window not tab