Added success and error callbacks to submitReference function