Refactor sys_exec to allow for easier useage from inside the kernel