updated code to use prior