see below for a possible simpler solution, tell me what you think