Move mouse code to separate file.