initial implementation of p3
functional implementation of p3