Port PSA expiration hadling code. Closes #656