Fixed up ioctl, added a few comments