Various changes, wrote gen_pass and mkpass