The question has been put on hold with the reason code not implemented or not working as intended.
It is a curious case: in fact, the code is implemented, and does work as intended. The OP just didn't realize that.
Unfortunately the people voting to close also didn't recognize it. They were mislead by the OP statement.
It seems to be a manifestation of the larger problem, namely the vagueness of to the best of the author's knowledge clause. When an author admits the problem we are happy to close (and downvote) the question; when the author does not, we keep going even if the bugs are gaping, and the code couldn't possibly work (see e.g. this question). In fact, we punish honesty.
I strongly suggest to remove, or at least rephrase that clause.