Adds error handling to pushFinally
Adds setreferences function with expected params