better checkout logic