Update controller example

Fix errors and introduce more compact form of the previous example.