changing to use open instead of copen