Change they key function to take location inputs