Some refactoring, added a mouse drag highlight.