Improve Join keyPressed method