p-whap:   Structure and main implementation of whap.