Some structure and example script from courses.cs.ut.ee.