moved memcpy to a static function, started work on ioctl