I'm just seeing this now, 40 minutes is a little tight, can you extend the deadline at all?
I'll give it a try.
is the code you pasted something you were given and have to use, or is it your work in progress so far?
I'm sorry,After reviewing the question, I regret that I won't be able to assist you at this time.
I am opting out and opening the question up to other professionals here who may be able to help.