Note: I wrote my answer before reading edan's answer edan's answer, which heavily influenced the code in the updated question. As a result my answer is more of an addition to edan's answer rather than being independent and focusing on the author's original code.
Note: I wrote my answer before reading edan's answer, which heavily influenced the code in the updated question. As a result my answer is more of an addition to edan's answer rather than being independent and focusing on the author's original code.
Note: I wrote my answer before reading edan's answer, which heavily influenced the code in the updated question. As a result my answer is more of an addition to edan's answer rather than being independent and focusing on the author's original code.
Note: I wrote my answer before reading edan's answer , which heavily influenced the code in the updated question. As a result my answer is more of an addition to edan's answer rather than being independent and focusing on the author's original code.
Note: I wrote my answer before reading edan's answer , which heavily influenced the code in the updated question. As a result my answer is more of an addition to edan's answer rather than being independent and focusing on the author's original code.