finished rewriting. didn't do drag. now for debugging