changed reverse fn