Modify P01 and P02 implementation

- Use reverse function