Updated with functions and tests for PE3