upgraded to use prime independent util functions and upgraded syntax to the current version of prime