Hideous code example but useful to kick start graduate training