messed around with resistance function