implement proper input buffer