implementing console.waitkey