convert to readline and strtol for inputs