Refined the "pressed key move x" function.