The code in my previous message was wrong (there were remnants of the code I based my example on). I edited my message.