Modified ptr code bits to follow best practices
04.16.16: Changed to only PTR support so I'm not stealing credit from the original developer.