factored out exercise 1