made examples callable and added the error handling to a function