Sample code from course taken at University of Oregon and Hong Kong University