simplified and added an example