First part of the selection tool. Not completely implemented.