added in code from in-class cloud notes. modified it to fit our app.