Functional tutorial. Will clean up code next.