cleaned up pifon code