added a dup2 with side effects case and organized some stuff