use gets instead of read