improved RPI implementation and reworked header structure