Reorder checks, unwrap code