Added error checking for retrieving challenges and notes from database.