add stackoverflow-based example with my edits