Working code with example