working on some pads algorithms