Ported input code to PC